#ifndef __BSTREE_H__
#define __BSTREE_H__

#include <stddef.h>
typedef struct BSTNode {
  void *data;
  struct BSTNode *lchild, *rchild;
} BSTNode;

typedef struct BSTree_t {
  BSTNode *root;
  size_t size;
} *BSTree;

typedef void (*trv_t)(void *);

typedef int (*cmpr_t)(void *, void *);

int init_BST(BSTree *tr, size_t size);

int push_BST(BSTree tr, const void *data, const cmpr_t cmpr);

int pop_BST(BSTree tr, const void *data, const cmpr_t cmpr);

void *find_index_BST(const BSTree tr, const void *data, const cmpr_t cmpr);

int trave_BST(const BSTree tr, const trv_t trv);

int destory_BST(BSTree *tr);

#endif // !__BSTREE_H__
